<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <title>管理平台</title>
    <jsp:include page="../../../include/header.jsp"></jsp:include>
        <style type="text/css">
			table td{
			text-align: center;
			white-space: normal; 
			overflow: hidden;
		    text-overflow: ellipsis;
			}
		 	table th{
			text-align: center;
		 	}
		 	  /*排序 */
			.querySort{
			   position:relative;
			}
			.down{
			   position: absolute;
			   top:12px;
			   display:inline-block;
			   width:10px;
			   height:12px;
			   margin-left: 8px;
			   background: url("${BASE_PATH}/static/images/sprite-arrow.png") 0 61px;
			}
		    .sort .querySort:NTH-OF-TYPE(2) .down{
			    top:-3px;
			    transform: rotateX(180deg);
			}
			.querySort:hover .down{
			   background: url("${BASE_PATH}/static/images/sprite-arrow.png") 0 21px;
			}
			
		  .downSort{
			    position: absolute;
			    top: 3px;
			    left: 3px;
			    width: 18px;
			    height: 24px;
			    opacity: 0;
			    cursor:pointer;
			}
		    .upSort {
			    position: absolute;
			    top: -15px;
			    left: 3px;
			    width: 18px;
			    height: 24px;
			    opacity: 0; 
			    cursor:pointer;
			}
		</style>
</head>
<body>
<div id="wrapper">

	        <div class="col-lg-12">
				<h1 class="page-header">统计收藏商品的用户信息</h1>
			</div>
            <div class="row">
					<div>
						<div class="text-muted single-line-text pull-left">共 <font color="#428bca" id="dataCount">0</font> 条记录</div>
					  <button onclick="doExcel();"  class="btn btn-success pull-right">导出</button>
					</div>				    
			</div>
			<div class="row">
					<div class="text-muted single-line-text pull-left">商品名称：【${goods.name}】
					</div>	
			</div>
			<div class="table-responsive panel panel-default">
				<table id="dataTable" class="table table-hover table-bordered " style=" overflow:scroll;word-break:break-all; word-wrap:break-all;">
		            <thead>
		                <tr>	
		                    <th width="100px">会员姓名</th>			                	
							<th width="150px" style="text-align: center">会员手机号</th>
							<th width="300px" style="text-align: center">所属分公司</th>
							<th width="100px" style="text-align: center">办卡销售</th>
							<th width="150px" style="text-align: center">办卡日期</th>
							<th width="100px" style="text-align: center">会员状态</th>
						<!-- 	<th width="100px" style="text-align: center">消费次数</th> -->
							<th width="100px" style="text-align: center">线上消费总金额</th>
							<th width="100px" style="text-align: center">积分</th>
							<th width="100px" style="text-align: center">抵扣券</th>
							<th width="100px" style="text-align: center">惠券</th>
							<th width="100px" style="text-align: center">线上消费次数</th>
		                </tr>			            
		            </thead>
		            <tbody id="dataList"></tbody>
		        </table>
			</div>
	        <div class="row">
	        	<div class="col-lg-12">
	        		<ul id="dataPagination" class="pagination-sm pull-right"></ul>
	        	</div>
	        </div>	
		</div>

<jsp:include page="../../../include/javascripts.jsp"></jsp:include>
<!-- 异步加载下一页数据后，用模板渲染 -->
<script type="text/html" id="thumbTpl">
<a href="javascript:void(0)" onclick="Kit.photo('{{thumb}}')" class="center-block thumbnail thumbnail-none-margin width50"><img src="{{thumb}}"></a>
</script>
<script type="text/html" id="dataTpl">
	{{each list as item}}
	<tr id="item{{item.id}}" data-id="{{item.id}}">	
       
		<td style="text-align: center">{{item.name}}</td>
	    <td style="text-align: center">{{item.phone}}</td>		
		<td style="text-align: center">{{item.storeName}}
				{{if !item.storeName}}无{{/if}}		
		</td>
		<td style="text-align: center">{{item.toBossOneId}}</td>
		<td style="text-align: center">{{item.createDate}}</td>
		<td style="text-align: center">{{item.state | flagTransform:1,'未登录',2,'未注册',3,'会员'}}</td>
		
        {{if item.amount==null}}
			 <td>0</td>
	    {{else }}
			<td style="text-align: center">{{item.amount }}</td>
		{{/if}}

       
		<td style="text-align: center">{{item.sppoint}}</td>
		<td style="text-align: center">{{item.jkpoint}}</td>
		<td style="text-align: center">{{item.jypoint}}</td>
	    <td style="text-align: center">{{item.ordernum}}</td>
	</tr>
	{{/each}}
</script>

<script type="text/javascript">
var dataPaginator;
var goodsId="${goodsId}";

  $(query); 
function query(){	
	 if(dataPaginator){
		dataPaginator.destroy();
	} 
	dataPaginator = Kit.pagination("#dataPagination","${BASE_PATH}/bus/goods/store/doCountCon",{goodsId:goodsId,"pageSize":10},function(result){

		console.log(result.object);
		//设置显示最新的数据数量
		$("#dataCount").html(result.object.totalRow);
		//根据模板渲染数据并填充
		$("#dataList").empty().append(template("dataTpl",result.object));
	});
} 

function doExcel(){	
	 window.location.href="${BASE_PATH}/bus/goods/store/doCollectExcel?goodsId="+goodsId;
	}
	
</script>
</body>
</html>